// import logo from './logo.svg';
// import './App.css';
import React from 'react';
import {
  // BrowserRouter,
  Routes,
  Route,
  // Link
} from "react-router-dom";

import ViewApp from './dsj1';
import EchartsViewGaugeDemo from './ant-demo/EchartsViewGaugeDemo';
import TableView from './ant-demo/table';
import LayoutDemo from './ant-demo/layoutDemo';
import UseStateExample from './hook-demo/useStateDemo';
import DatePickerDemo from './ant-demo/DatePickerDemo';
import ModalAddFrom from './ant-demo/ModalAddFrom';
import FatherFun from './hook-demo/f-s/FatherAndSon';
import FatherFunModal from './hook-demo/s-f/FatherFun';
import ModalAddFromAddTable from './hook-demo/table-crud/ModalAddFromAddTable';

class App extends React.Component {

  componentDidMount = () => {
    // console.log('原生Ajax');
    // var xmlhttp = new XMLHttpRequest();
    // //http://www.nhc.gov.cn/xcs/yqtb/list_gzbd.shtml //信息来自国家卫生健康委员会官方网站
    // //https://static-2c1ea984-de3e-488c-9c66-17561bab77a3.bspapp.com/fengxian/  //数据来自github,非官方数据，仅供参考
    // xmlhttp.open('get', 'https://a68962b2-18d0-4812-854e-b4179d81a71f.bspapp.com/http/fengxian?p=1&_=1669272721709');
    // // xmlhttp.open('get', 'https://www.tianqiapi.com/api?appid=23035354&appsecret=8YvlPNrz&version=v9&cityid=0&city=太原&ip=0&callback=0');
    // xmlhttp.send();

    // xmlhttp.onreadystatechange = function () {
    //   if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
    //     var str = xmlhttp.responseText;
    //     // console.log(str)
    //     //Text to json
    //     // var jsonObject = eval('(' + str + ')');
    //     var jsonObject = JSON.parse(str)
    //     console.log(jsonObject)
    //   }
    // }

  }

  render() {
    return (
      <>
        <Routes>
          <Route path='/' element={<LayoutDemo />} >
            <Route index element={<ViewApp />} />
            <Route path='/antd/layoutDemo/useStateExample' element={<UseStateExample />} />
            <Route path='/antd/layoutDemo/modalAddFrom' element={<ModalAddFrom />} />
            <Route path='/antd/layoutDemo/table' element={<TableView />} />
            <Route path="/antd/layoutDemo/echartsViewGaugeDemo" element={
              <EchartsViewGaugeDemo msg="测试abc123" >
                {{ key1: 111, key2: 222 }}
              </EchartsViewGaugeDemo>
            } />
            <Route path='/antd/layoutDemo/datePickerDemo' element={<DatePickerDemo />} />

            <Route path='/antd/layoutDemo/fatherFun' element={<FatherFun />} />
            <Route path='/antd/layoutDemo/sonFun' element={<FatherFunModal />} />
            <Route path='/antd/layoutDemo/tableAddModal' element={<ModalAddFromAddTable />} />
          </Route>
        </Routes>
      </>
    )
  }
};

export default App;
